public class Worker extends Employee{
    private double grade;
    private LevelEnum level;
    public Worker(String name,double perSalary,int workDate,double grade,LevelEnum level){
        super(name,perSalary,workDate);
        this.grade=grade;
        this.level=level;
    }
    public Worker(String name,double perSalary,int workDate,LevelEnum level){
        super(name,perSalary,workDate);
//       通过构造函数设置grade的默认值
//        this.grade=1.0;
        this.level=level;
    }
    public double getGrade(){
        return grade;
    }
    public void setGrade(double grade){
        this.grade=grade;

    }

    public LevelEnum getLevel() {
        return level;
    }

    public void setLevel(LevelEnum level) {
        this.level = level;
    }

    @Override
    public void printSalary(){
        if(this.level==LevelEnum.manager){
            double total;
            total=1000+getWorkDate()*getPerSalary()*getGrade();
            System.out.println("经理级雇员姓名："+getName()+",工资:"+total);
        } else if (this.level==LevelEnum.ordinary) {
            double total;
            total=getWorkDate()*getPerSalary()*getGrade();
            System.out.println("普通雇员姓名："+getName()+",工资:"+total);
        } else if (this.level==LevelEnum.coder) {
            double total;
            setGrade(1.0);
            total=5000+getPerSalary()*getWorkDate()*getGrade();
            System.out.println("编码工程师姓名："+getName()+",工资:"+total);

        }

    }

    @Override
    public String toString() {
        return "Worker{" +
                "grade=" + grade +
                ", level=" + level +
                '}';
    }
}
